package com.example.springbatch_step_chuck;

import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.StepExecutionListener;
import org.springframework.stereotype.Component;

/**
 * 自定义step监听器
 */
@Component
public class MyStepListener implements StepExecutionListener {

    @Override
    public void beforeStep(StepExecution stepExecution) {

        System.out.println("------ before listener ------");
    }

    @Override
    public ExitStatus afterStep(StepExecution stepExecution) {
        System.out.println("------ after listener ------");

        return stepExecution.getExitStatus();
    }
}
